<template>
	<view>
		<nav-bar-sub></nav-bar-sub>
		<showNote :data='notes' @refresh='refresh' :key='comKey'></showNote>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				comKey: 0,
				notes: []
			}
		},
		methods: {
			refresh() {
				this.$api.getMyNote(this.$store.state.access_token, '')
					.then(res => {
						res.values.records.forEach(item => {
							item.noteContent = item.noteContent
						})
						this.notes = res.values.records
						this.comKey += 1
					})
			}
		},
		onReady: function(option) { //option为object类型，会序列化上个页面传递的参数
			this.$api.getMyNote(this.$store.state.access_token,'')
			.then(res=>{
				console.log(res);
				res.values.records.forEach(item => {
					item.noteContent = item.noteContent
				})
				this.notes = res.values.records
				console.log(this.notes);
			})
		}
	}
</script>

<style lang="scss">
	page{
		height: 100%;
		background-color: $uni-bg-color;
	}
</style>
